﻿using JustTest.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Providers.Entities;

namespace JustTest.Author
{
    public class TestRepository : GenericRepository<JustTest.Models.Test>
    {
        public override JustTest.Models.Test Create(JustTest.Models.Test item)
        {
            item.Category = this.context.Set<Category>().Find(item.Category.Id);
            item.User = this.context.Set<ApplicationUser>().First(x => x.UserName == item.User.UserName);
            item.Description = String.Empty;
            item = this.context.Set<JustTest.Models.Test>().Add(item);
            return item;
        }
    }
}